-- StressTest
-- Create by panyl
-- 压力测试

require "stress_test/CommandM"

require "stress_test/Agent"
require "stress_test/login"
require "stress_test/tacticsM"

StressTest = StressTest or {};

local defaultUserCount = 100;

local update;

function StressTest.start(account, count)
    if DEBUG_MODE ~= 1 or STRESS_TEST ~= 1 then
        return;
    end

    count = tonumber(count) or defaultUserCount;

    trace("StressTest", "**** 开始进行压力测试，登录 %d 人。", count);

    -- 初始化消息指令管理器
    CommandM.init();
    login.init();
    tacticsM.init();

    -- 1. 登录测试
    login.start(account, count);

    -- 定时循环处理登录
    cc.Director:getInstance():getScheduler():scheduleScriptFunc(update, 1, false);
end

update = function()
    --login.update();

    tacticsM.update();
end
